import {Component, Input, OnInit} from '@angular/core';
import {TeacherService} from "../teacher/teacher.service";

@Component({
  selector: 'app-student',
  templateUrl: './student.component.html',
  styleUrls: ['./student.component.less']
})
export class StudentComponent implements OnInit {

  @Input()
  studentName: string;

  @Input()
  errorFlag: number = 1;

  constructor(private teacherService: TeacherService) {
  }

  ngOnInit() {
  }

  likeMe() {
    if (this.errorFlag === 1) {

      this.teacherService.likeMe(this.studentName);
    } else {
      this.teacherService.likeMeValue = this.studentName;
    }
  }

}
